<template>
  <div>
    <form>
      <div>
        <label>姓名：</label>
        <input type="text" v-model="travelApplication.RealName" />
      </div>
      <div>
        <label>部门：</label>
        <input type="text" v-model="travelApplication.Department" />
      </div>
      <div>
        <label>出差日期：</label>
        <input type="date" v-model="travelApplication.StartDate" />
      </div>
      <div>
        <label>结束日期：</label>
        <input type="date" v-model="travelApplication.EndDate" />
      </div>
      <div>
        <label>出差地点：</label>
        <input type="text" v-model="travelApplication.Destination" />
      </div>
      <div>
        <label>交通工具：</label>
        <select v-model="travelApplication.VehicleName">
          <option value="">请选择</option>
          <option value="飞机">飞机</option>
          <option value="火车">火车</option>
          <option value="汽车">汽车</option>
        </select>
      </div>
      <div class="">
        <label>工作任务：</label>
        <textarea v-model="travelApplication.Purpose"></textarea>
      </div>

      <div>
        <hr>
      </div>

      <label class="AaA">下一步审批人：</label>
      <div class="AAA">
      <div class="aaa">
        <select v-model="nextApprover" class="asas">
          <option value="">请选择</option>
          <!-- 这里可以通过v - for循环来渲染实际的审批人选项，此处省略 -->
        </select>
      </div>
      </div>
      <div class="aaaa">
        <button type="button" style="margin-right: 50px;" @click="submitApplication">确定</button>
        <button type="button" @click="cancelApplication">取消</button>
      </div>
    </form>
  </div>
</template>

<script>
export default {
  data() {
    return {
      travelApplication: {
        RealName: "",
        Department: "",
        StartDate: "",
        EndDate: "",
        Destination: "",
        VehicleName: "",
        Purpose: ""
      },
      nextApprover: ""
    };
  },
  methods: {
    submitApplication() {
      // 这里可以添加axios请求，将travelApplication数据发送到后端Spring Boot
      console.log("提交出差申请：", this.travelApplication);
      // 例如：
      // axios.post('/api/travel - applications', this.travelApplication)
      //  .then(response => {
      //     console.log('申请提交成功', response.data);
      //   })
      //  .catch(error => {
      //     console.error('申请提交失败', error);
      //   });
    },
    cancelApplication() {
      // 这里可以添加取消操作的逻辑，例如重置表单等
      console.log("取消出差申请");
    }
  }
};
</script>

<style>
hr{
  border: 1px solid #000000;
  margin-bottom: 20px;
}

.aaaa{
  position: relative;
  left: 1000px;
  top: -70px;
  width: 100%;

  height: 100%;
  justify-content: space-around; /* 按钮水平均匀分布 */

}

.AaA{
position: relative;

  top: 20px;
}

.AAA{
  transform: translateX(120px);
}

.aaa{
  transform: translateY(-20px);
}

/*.move-down {*/
/*  transform: translateX(125px); /* 向右移动20px */
/*}*/

/*.move-down { */
/*transform: translateY(-20px);  向下移动20px */
/*} */

.asas{
width: 50%;
padding: 10px;
margin-bottom: 15px;
border: 1px solid #ccc;
border-radius: 3px;
box-sizing: border-box;
}

form {
width: 100%;
padding: 20px;
background-color: #f9f9f9;
border: 1px solid #ccc;
border-radius: 5px;
}

label {
display: block;
margin-bottom: 5px;
font-weight: bold;
font-size: 14px;
}

input[type="text"],
input[type="date"],
select,
textarea {
width: 100%;
padding: 10px;
margin-bottom: 15px;
border: 1px solid #ccc;
border-radius: 3px;
box-sizing: border-box;
}

textarea {
height: 100px;
}

button {
padding: 10px 20px;
border: none;
border-radius: 3px;
cursor: pointer;
}

button[type="button"] {
margin-right: 10px;
}

button[type="button"]:nth-child(1) {
background-color: #4CAF50;
color: white;
}

button[type="button"]:nth-child(2) {
background-color: #f44336;
color: white;
}

button[type="button"]:hover {
opacity: 0.8;
}
</style>
